package cn.kgc.crowdfundingadmin.service;

import cn.kgc.crowdfundingadmin.mapper.MenuMapper;
import cn.kgc.crowdfundingadmin.pojo.Menu;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author shkstart
 * @create 2020-02-27 14:36
 */
@Service("menuService")
public class MenuServiceImpl implements  MenuService {

    @Resource
    MenuMapper menuMapper;
    @Override
    public List<Menu> getAll() {

        return menuMapper.selectByExample(null);
    }

    @Override
    public void saveMenu(Menu menu) {
        menuMapper.insert(menu);
    }

    @Override
    public Menu getById(Integer menuId) {

        return menuMapper.selectByPrimaryKey(menuId);
    }

    @Override
    public Integer update(Menu menu) {
        return menuMapper.updateByPrimaryKeySelective(menu);
    }

    @Override
    public void delete(Integer id) {
         menuMapper.deleteByPrimaryKey(id);
    }
}
